package doughnut.xc.Demo;

import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import doughnut.xc.pojo.User;

import java.io.FileInputStream;
import java.util.List;

/**
 * 使用easypoi 导入测试
 */
public class EasyPoiImportDemo {
    public static void main(String[] args) throws Exception {
        ImportParams importParams = new ImportParams();
        // 是否保存上传的文件 默认false
        importParams.setNeedSave(false);
        // 大标题 默认0
        importParams.setTitleRows(1);
        // 小标题 默认1
        importParams.setHeadRows(1);

        FileInputStream fis = new FileInputStream("C:\\Users\\29469\\OneDrive\\桌面\\UserDetail.xlsx");

        List<User> list = ExcelImportUtil.importExcel(fis, User.class, importParams);
        for (User user : list) {
            System.out.println(user);
        }
        fis.close();
    }
}
